import { MockMethod } from "vite-plugin-mock";
import { resultSuccess } from "../_utils";
import { AppRoute } from "@scpun/core";

const homeRoute: AppRoute[] = [
    {
        id: 10,
        parentId: 0,
        name: "Home",
        path: "/home",
        component: "BASIC_LAYOUT",
        redirect: "/home/index",
        meta: {
            title: "首页",
            hideChildrenInMenu: true,
            icon: "icon-park-outline:home",
        },
    },
    {
        id: 11,
        parentId: 10,
        name: "HomeIndex",
        path: "index",
        component: "/home/index.vue",
        meta: {
            title: "首页",
            icon: "icon-park-outline:home",
            affixTab: true,
        },
    },
];

const systemRoute: AppRoute[] = [
    {
        id: 20,
        parentId: 0,
        name: "System",
        path: "/system",
        component: "BASIC_LAYOUT",
        redirect: "/system/user",
        meta: {
            title: "系统管理",
            icon: "icon-park-outline:system",
        },
    },
    {
        id: 21,
        parentId: 20,
        name: "SystemUser",
        path: "user",
        component: "/system/user/index.vue",
        meta: {
            title: "用户管理",
            icon: "icon-park-outline:user",
        },
    },
    {
        id: 22,
        parentId: 20,
        name: "SystemRole",
        path: "role",
        component: "/system/role/index.vue",
        meta: {
            title: "角色管理",
            icon: "icon-park-outline:user-to-user-transmission",
        },
    },
    {
        id: 23,
        parentId: 20,
        name: "SystemMenu",
        path: "menu",
        component: "/system/menu/index.vue",
        meta: {
            title: "菜单管理",
            icon: "icon-park-outline:list",
        },
    },
    {
        id: 24,
        parentId: 20,
        name: "SystemOrganization",
        path: "organization",
        component: "/system/organization/index.vue",
        meta: {
            title: "机构管理",
            icon: "icon-park-outline:user-business",
        },
    },
    {
        id: 25,
        parentId: 20,
        name: "SystemPosition",
        path: "position",
        component: "/system/position/index.vue",
        meta: {
            title: "岗位管理",
            icon: "icon-park-outline:user",
        },
    },
    {
        id: 26,
        parentId: 20,
        name: "SystemParams",
        path: "params",
        component: "/system/params/index.vue",
        meta: {
            title: "参数管理",
            icon: "icon-park-outline:data-three",
        },
    },
    {
        id: 26,
        parentId: 20,
        name: "SystemDictionary",
        path: "dictionary",
        component: "/system/dictionary/index.vue",
        meta: {
            title: "数据字典",
            icon: "icon-park-outline:data-file",
        },
    },
];

const monitorRoute: AppRoute[] = [
    {
        id: 30,
        parentId: 0,
        name: "Monitor",
        path: "/monitor",
        component: "BASIC_LAYOUT",
        redirect: "/monitor/datasource",
        meta: {
            title: "系统监控",
            icon: "icon-park-outline:monitor",
        },
    },
    {
        id: 31,
        parentId: 30,
        name: "MonitorDatasource",
        path: "datasource",
        component: "/monitor/datasource/index.vue",
        meta: {
            title: "数据源管理",
            icon: "icon-park-outline:data-screen",
        },
    },
    {
        id: 32,
        parentId: 30,
        name: "MonitorSchedule",
        path: "schedule",
        component: "/monitor/schedule/index.vue",
        meta: {
            title: "定时任务",
            icon: "icon-park-outline:timeline",
        },
    },
    {
        id: 33,
        parentId: 30,
        name: "MonitorOnline",
        path: "online",
        component: "/monitor/online/index.vue",
        meta: {
            title: "在线用户",
            icon: "icon-park-outline:user-positioning",
        },
    },
    {
        id: 34,
        parentId: 30,
        name: "MonitorPerformance",
        path: "performance",
        component: "/monitor/performance/index.vue",
        meta: {
            title: "性能监控",
            icon: "icon-park-outline:performance",
        },
    },
    {
        id: 34,
        parentId: 30,
        name: "MonitorCache",
        path: "cache",
        component: "/monitor/cache/index.vue",
        meta: {
            title: "缓存管理",
            icon: "icon-park-outline:cable-car",
        },
    },
    {
        id: 35,
        parentId: 30,
        name: "MonitorCacheMonitor",
        path: "cache-monitor",
        component: "/monitor/cache-monitor/index.vue",
        meta: {
            title: "缓存监控",
            icon: "icon-park-outline:computer",
        },
    },
];

const componentRoute: AppRoute[] = [
    {
        id: 70,
        parentId: 0,
        name: "Component",
        path: "/component",
        component: "BASIC_LAYOUT",
        redirect: "/component/index",
        meta: {
            title: "组件示例",
            icon: "icon-park-outline:components",
        },
    },
    {
        id: 71,
        parentId: 70,
        name: "ComponentIndex",
        path: "index",
        component: "/demo/icon/index.vue",
        meta: {
            title: "图标组件",
            icon: "icon-park-outline:aiming",
        },
    },
    {
        id: 72,
        parentId: 70,
        name: "Crontab",
        path: "crontab",
        component: "/demo/cron/index.vue",
        meta: {
            title: "CRON表达式",
            icon: "icon-park-outline:aiming",
        },
    },
    {
        id: 73,
        parentId: 70,
        name: "Cropper",
        path: "cropper",
        component: "/demo/cropper/index.vue",
        meta: {
            title: "图片裁剪工具",
            icon: "icon-park-outline:aiming",
        },
    },
    {
        id: 73,
        parentId: 70,
        name: "BpmnDesigner",
        path: "bpmn-designer",
        component: "/demo/bpmn/index.vue",
        meta: {
            title: "流程设计器",
            icon: "icon-park-outline:paint",
        },
    },
];

const aboutRoute: AppRoute[] = [
    {
        id: 40,
        parentId: 0,
        name: "Offical",
        path: "/offical",
        component: "BASIC_LAYOUT",
        redirect: "/offical/index",
        meta: {
            title: "关于",
            icon: "icon-park-outline:file-question",
            hideChildrenInMenu: true,
        },
    },
    {
        id: 41,
        parentId: 40,
        name: "OfficalIndex",
        path: "index",
        component: "/demo/about/index.vue",
        meta: {
            title: "关于",
            icon: "icon-park-outline:file-question",
        },
    },
];

const docsRoute: AppRoute[] = [
    {
        id: 50,
        parentId: 0,
        name: "Docs",
        path: "/docs",
        component: "BASIC_LAYOUT",
        redirect: "/docs/index",
        meta: {
            title: "部署文档",
            icon: "icon-park-outline:help",
            hideChildrenInMenu: true,
        },
    },
    {
        id: 51,
        parentId: 50,
        name: "DocsIndex",
        path: "index",
        component: "IFRAME_LAYOUT",
        meta: {
            title: "部署文档",
            icon: "icon-park-outline:computer",
            iframeSrc: "https://www.scpun.com",
            openInNewWindow: true,
        },
    },
];

const outLinkRoute: AppRoute[] = [
    {
        id: 60,
        parentId: 0,
        name: "OutLink",
        path: "/out-link",
        component: "BASIC_LAYOUT",
        meta: {
            title: "外链打开",
            icon: "icon-park-outline:link",
        },
    },
    {
        id: 61,
        parentId: 60,
        name: "OutLinkIndex",
        path: "index",
        component: "BLANK_LAYOUT",
        meta: {
            title: "百度一下",
            icon: "icon-park-outline:link",
            link: "https://www.baidu.com",
        },
    },
    {
        id: 62,
        parentId: 60,
        name: "OutLinkDocs",
        path: "docs",
        component: "BLANK_LAYOUT",
        meta: {
            title: "官方网站",
            icon: "icon-park-outline:link",
            link: "https://www.scpun.com",
        },
    },
];

export default [
    {
        url: "/mock-api/oauth2/routes",
        method: "get",
        timeout: 1000,
        response: () => {
            return resultSuccess([...homeRoute, ...systemRoute, ...componentRoute, ...monitorRoute, ...docsRoute, ...outLinkRoute, ...aboutRoute]);
        },
    },
] as MockMethod[];
